[][src]Crate test

Support code for rustc's built in unit-test and micro-benchmarking framework.

Almost all user code will only be interested in Bencher and black_box. All other interactions (such as writing tests and benchmarks themselves) should be done via the #[test] and #[bench] attributes.

See the Testing Chapter of the book for more details.

Re-exports

pub use self::TestFn::*;
pub use self::ColorConfig::*;
pub use self::TestResult::*;
pub use self::TestName::*;

Modules

bench
stats
test

Structs

BenchSamples
Bencher

Manager of the benchmarking runs.

Metric
MetricMap
Options

In case we want to add other options as well, just add them in this struct.

TestDesc
TestDescAndFn
TestOpts

Enums

BenchMode
ColorConfig
NamePadding
OutputFormat
RunIgnored
ShouldPanic
TestEvent
TestFn
TestName
TestResult

Traits

TDynBenchFn

Represents a benchmark function.

Termination

Invoked when unit tests terminate. Should panic if the unit test is considered a failure. By default, invokes report() and checks for a 0 result.

Functions

assert_test_result
black_box
convert_benchmarks_to_tests
filter_tests
fmt_bench_samples
iter
list_tests_console
parse_opts
run_test
run_tests
run_tests_console
test_main
test_main_static

Type Definitions

MonitorMsg
OptRes

Result of parsing the options.